package acm;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Comparator;

public class array {
    public static void main(String[] args){
        Integer[] a={3,5,9,87,4,9,32,51,50};
        Comparator cmp = new MyComparator();
        Arrays.sort(a,cmp);
        System.out.print(Arrays.toString(a));
    }
}
class MyComparator implements Comparator<Integer> {
    public int compare(Integer o1,Integer o2){
        if (o1<o2){
            return 1;
        }
        else if (o1>o2){
            return -1;
        }
        else {
            return 0;
        }
    }
}
